package com.project;

import co.elastic.clients.elasticsearch.ElasticsearchClient;
import co.elastic.clients.elasticsearch.core.IndexResponse;
import com.project.pojo.Admin;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.IOException;

public class Test1 {
    @Autowired
    public ElasticsearchClient client;
    public void testindex() throws IOException {
        Admin admin = new Admin();
        admin.setId(1);
        admin.setUsername("lisi");
        admin.setPassword("asdasd");
        IndexResponse indexResponse = client.index(i->i.index("user").id("1").document(admin));
    }
    public static void main(String[] args) throws IOException {
        Test1 test1 = new Test1();
        test1.testindex();
    }
}
